<template>
	<view class="container" >
		<view class="" v-if="!loadingpage">
			<view class="topBanner">
				<image :src="imgUrl(info?.home_bg)" style="width: 100%;height: 650rpx;" mode="scaleToFill"></image>
			</view>
			<view class="content"> 
				<view class="menuLink">
					<uv-row gutter="20">
						<uv-col span="4">
							<view class="bgWrite" @click="route({type:'tab',url:'pages/tabbar/lesson'})">
								<image src="@/static/img/icon01.png" style="width: 111rpx; height: 111rpx;"></image>
								<text class="tex01">一学就会</text>
							</view>
						</uv-col>
						<uv-col span="4">
							<view class="bgWrite" @click="route('pages/index/noline')">
								<image src="@/static/img/icon02.png" style="width: 111rpx; height: 111rpx;"></image>
								<text class="tex01">一课难求</text>
							</view>
						</uv-col>
						<uv-col span="4">
							<view class="bgWrite" @click="route('pages/index/noline')">
								<image src="@/static/img/icon03.png" style="width: 111rpx; height: 111rpx;"></image>
								<text class="tex01">属你会玩</text>
							</view>
						</uv-col>
					</uv-row>
				</view>
			
				<view class="bgWrite p30">
					<uv-row>
						<uv-col span="9">
							<view><text class="txt02">Hello</text>
								<text class="txt03">欢迎加入懒学青年</text>
							</view>
						</uv-col>
						<uv-col span="3">
							<view>
							<button class="blueBtn"  style="padding:0 1px;"								v-if="getStorage('token')">{{nick?.name}}</button>								<button class="blueBtn" @click="route('pages/login/login1')" style="padding:0 10px;"									v-else>快速注册</button>
							</view>
						</uv-col>
					</uv-row>
				</view>
				<!-- <view class="bgWrite p30" style="margin-top:20rpx;">
					<uv-parse :content="infos?.content"></uv-parse>
				</view> -->
				<view class="cardBox" @click="route('pages/login/ping')">
					<view class="cardTtl">
						<image src="@/static/img/img03.png" style="width: 263rpx; height: 40rpx;"></image>
					</view>
					<!-- <view class="cardTxt">
						<uv-row>
							<uv-col span="2">积分</uv-col>
							<uv-col span="2">余额</uv-col>
							<uv-col span="6">
								<image src="@/static/img/icon04.png" style="width: 45rpx; height:45rpx;"></image>
							</uv-col>
							<uv-col span="2">{会员}</uv-col>
						</uv-row>
					</view> -->
				</view>
			</view>
			  <DragButton>
			        <uv-button open-type="contact" :customStyle="{borderRadius:'99rpx 0 0 99rpx '}" color="#31c0ed" >
			        	<image class="logo" src="@/static/img/icon10.png"
			        		style="width: 60rpx; height: 60rpx; margin-right: 10rpx; vertical-align: middle;">
			        	</image><text style="font-size:26rpx;">课程顾问</text>
			        </uv-button>
			        </DragButton>
		<!-- 	<view class="serviceFloat">
			
			</view> --> 
		</view>
		<view class="lanse" v-if='loadinglan'></view>
		<view class="loading" v-if='loadinglan'>
			<image class="image" :src="imgUrl(info?.start_page)"></image>
		</view>
		
	</view>
</template>
<script setup lang="ts">
	import route from '@/utils/route';
	import { toast, imgUrl } from '@/utils/fun';
	import DragButton from '@/components/dragon-dragButton/index.vue'
	import { onLoad, onShow } from '@dcloudio/uni-app';
	import { ref, watch } from 'vue';
	import { http, apiPath } from '@/common/http/index';
	import { userStorage } from '@/hooks/useStorage';
	const { getStorage } = userStorage();
	uni.hideTabBar();
	onLoad(() => {
		if (getStorage('token')) {
			get_nick();
		}
		setTimeout(()=>{
			loadingpage.value=false
		},1500)
		
		setTimeout(()=>{
			loadinglan.value=false
			uni.showTabBar();
		},3000)
		
		get_info();
		get_Ping();
	});
		const loadinglan = ref(true)
	const loadingpage = ref(true)
	const info = ref({})
	
	//获取背景图
	const get_info = async () => {
		info.value = (await http.get('/api/v1/setting')).data;//获取左侧菜单
	};
	const infos = ref() as any
	//获取介绍
	const get_Ping = async () => {
		infos.value = (await http.get(`/api/v1/agreement?type=`+3)).data;//获取左侧菜单
		console.log("1111111",infos.value)
	};
	//获取昵称
	const nick = ref({})
	//获取背景图
	const get_nick = async () => {
		nick.value = (await http.get('/api/v1/user/info')).data;//获取左侧菜单

	};
</script>

<style lang="scss" scoped>
	.serviceFloat {
		font-size: 26rpx;
		position: fixed;
		right: -20px;
		bottom: 10%;
		height: 75rpx;
		line-height: 75rpx;
		text-align: center;
		color: #fff;
		opacity: 1;
		padding: 0 10px;
	}
	.loading{
		position: fixed;
		top:0;
		left:0;
		z-index: 2;
		.image{
			width: 750rpx;
			height:100vh;
		}
	}
	.container {
		background: #F8F8F8;
	}
	.lanse {
		position: fixed;
		top:0;
		left:0;
		z-index: 1;
		background: #31c0ed;
	}

	.content {
		padding: 30rpx;
	}

	.bgWrite {
		background: #fff;
		padding: 40rpx 20rpx;
		text-align: center;
		border-radius: 20rpx;
	}

	.tex01 {
		margin-top: 15rpx;
		font-size: 30rpx;
		display: flex;
		justify-content: center;
	}

	.menuLink {
		margin-bottom: 20rpx;
	}

	.txt02 {
		line-height: 70rpx;
		display: block;
		font-size: 30rpx;
	}

	.txt03 {
		display: block;
		font-size: 24rpx;
	}

	.blueBtn {
		font-size: 24rpx;
		border-radius: 180rpx;
		background: rgba(49, 192, 237, 1);
		border: none;
		color: #000;
		padding:0 10rpx;
	}

	::v-deep uni-button:after {
		border: none;
	}

	.cardBox {
		/* margin-bottom: 30rpx; */
		margin-top: 30rpx;
		padding: 25rpx 40rpx;
		border-radius: 20rpx;
		background:  url("@/static/img/index.png") no-repeat 100% center;
		background-size: 100% 100%;
		height:260rpx;
	}

	.cardTtl {
		margin-bottom: 100rpx;
	}

	.cardTxt {
		font-size: 28rpx;
		line-height: 50rpx;
	}

	.p30 {
		padding: 30rpx 40rpx;
	}
</style>